import {
  RequestMapping,
  RequestValue,
  SetApi,
} from "../../decorator/controller";

import BaseController from "../../base/BaseController";
import { JsonResultUtil, ResultBuild } from "../../tools";
import { Code } from "../../tools/code";

@SetApi("common")
export default class extends BaseController {
  @RequestMapping({ value: "get" })
  async get(data: any) {
    try {
      const p = ResultBuild([["id", Number]], data);
      if (p) {
        return p;
      }
      return JsonResultUtil();
    } catch (error: any) {
      return JsonResultUtil(Code.internal_server_error, error.stack);
    }
  }
}
